package create.singleton.singleton_demo1;

/**
 * 枚举来实现单例 可以避免反射序列化问题
 *
 * @author yeyangtao
 * @date 2020/5/19 17:38
 */
public enum Single6 {
    INSTANCE;
    private String name;
    private Integer age;

    public void doSomething() {
        System.out.println("do something");
    }

    Single6() {
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }
}
